/****** Object:  ForeignKey [FK_Humidity_LocationId]    Script Date: 06/14/2011 22:01:22 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Humidity_LocationId]') AND parent_object_id = OBJECT_ID(N'[dbo].[Humidity]'))
ALTER TABLE [dbo].[Humidity] DROP CONSTRAINT [FK_Humidity_LocationId]
GO
/****** Object:  ForeignKey [FK_LocationId_LocationId]    Script Date: 06/14/2011 22:01:23 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_LocationId_LocationId]') AND parent_object_id = OBJECT_ID(N'[dbo].[LocationId]'))
ALTER TABLE [dbo].[LocationId] DROP CONSTRAINT [FK_LocationId_LocationId]
GO
/****** Object:  ForeignKey [FK_SportSchedule_LocationId]    Script Date: 06/14/2011 22:01:23 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_SportSchedule_LocationId]') AND parent_object_id = OBJECT_ID(N'[dbo].[SportSchedule]'))
ALTER TABLE [dbo].[SportSchedule] DROP CONSTRAINT [FK_SportSchedule_LocationId]
GO
/****** Object:  ForeignKey [FK_SysTemp_LocationId]    Script Date: 06/14/2011 22:01:23 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_SysTemp_LocationId]') AND parent_object_id = OBJECT_ID(N'[dbo].[SysTemp]'))
ALTER TABLE [dbo].[SysTemp] DROP CONSTRAINT [FK_SysTemp_LocationId]
GO
/****** Object:  ForeignKey [FK_SysTraffic_LocationId]    Script Date: 06/14/2011 22:01:23 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_SysTraffic_LocationId]') AND parent_object_id = OBJECT_ID(N'[dbo].[SysTraffic]'))
ALTER TABLE [dbo].[SysTraffic] DROP CONSTRAINT [FK_SysTraffic_LocationId]
GO
/****** Object:  ForeignKey [FK_Windspeed_LocationId]    Script Date: 06/14/2011 22:01:23 ******/
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Windspeed_LocationId]') AND parent_object_id = OBJECT_ID(N'[dbo].[Windspeed]'))
ALTER TABLE [dbo].[Windspeed] DROP CONSTRAINT [FK_Windspeed_LocationId]
GO
/****** Object:  Table [dbo].[Humidity]    Script Date: 06/14/2011 22:01:22 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Humidity]') AND type in (N'U'))
DROP TABLE [dbo].[Humidity]
GO
/****** Object:  Table [dbo].[SportSchedule]    Script Date: 06/14/2011 22:01:23 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SportSchedule]') AND type in (N'U'))
DROP TABLE [dbo].[SportSchedule]
GO
/****** Object:  Table [dbo].[SysTemp]    Script Date: 06/14/2011 22:01:23 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SysTemp]') AND type in (N'U'))
DROP TABLE [dbo].[SysTemp]
GO
/****** Object:  Table [dbo].[SysTraffic]    Script Date: 06/14/2011 22:01:23 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SysTraffic]') AND type in (N'U'))
DROP TABLE [dbo].[SysTraffic]
GO
/****** Object:  Table [dbo].[Windspeed]    Script Date: 06/14/2011 22:01:23 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Windspeed]') AND type in (N'U'))
DROP TABLE [dbo].[Windspeed]
GO
/****** Object:  Table [dbo].[LocationId]    Script Date: 06/14/2011 22:01:23 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LocationId]') AND type in (N'U'))
DROP TABLE [dbo].[LocationId]
GO
/****** Object:  Table [dbo].[NameTable]    Script Date: 06/14/2011 22:01:23 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[NameTable]') AND type in (N'U'))
DROP TABLE [dbo].[NameTable]
GO
/****** Object:  Table [dbo].[SysDate]    Script Date: 06/14/2011 22:01:23 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SysDate]') AND type in (N'U'))
DROP TABLE [dbo].[SysDate]
GO
/****** Object:  Table [dbo].[SysDate]    Script Date: 06/14/2011 22:01:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SysDate]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[SysDate](
	[Hour] [datetime] NOT NULL,
	[Day] [nchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Holiday] [binary](50) NULL,
	[Weekend] [binary](50) NULL,
 CONSTRAINT [PK_SysDate] PRIMARY KEY CLUSTERED 
(
	[Hour] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)
)
END
GO
/****** Object:  Table [dbo].[LocationId]    Script Date: 06/14/2011 22:01:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LocationId]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[LocationId](
	[area_ID] [nvarchar](50) NOT NULL,
	[usage] [double] NOT NULL,
	[TimeAreaID] [datetime] NOT NULL,
 CONSTRAINT [PK_LocationId] PRIMARY KEY CLUSTERED 
(
	[TimeAreaID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON)
)
END
GO
/****** Object:  Table [dbo].[Windspeed]    Script Date: 06/14/2011 22:01:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Windspeed]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Windspeed](
	[Wind_Speed] [int] NULL,
	[TimeAreaID] [datetime] NOT NULL
)
END
GO
/****** Object:  Table [dbo].[SysTraffic]    Script Date: 06/14/2011 22:01:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SysTraffic]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[SysTraffic](
	[Speed] [int] NULL,
	[TimeAreaID] [datetime] NOT NULL
)
END
GO
/****** Object:  Table [dbo].[SysTemp]    Script Date: 06/14/2011 22:01:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SysTemp]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[SysTemp](
	[Temperature] [int] NULL,
	[TimeAreaID] [datetime] NOT NULL
)
END
GO
/****** Object:  Table [dbo].[SportSchedule]    Script Date: 06/14/2011 22:01:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SportSchedule]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[SportSchedule](
	[Sport_Schedule] [int] NULL,
	[Show_Schedule] [bigint] NULL,
	[TimeAreaID] [datetime] NOT NULL
)
END
GO
/****** Object:  Table [dbo].[Humidity]    Script Date: 06/14/2011 22:01:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Humidity]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Humidity](
	[Humidity] [int] NULL,
	[TimeAreaID] [datetime] NOT NULL
)
END
GO

